#pragma once

#include "Common/MessageDispatch/MessageDispatch.h"
#include "Common/Event/Event.h"
#include "Common/EventDefine.h"

class LogicCampModule : public IServerMessageHandler, public  IClientMessageHandler, public IEventExecuteSink
{
public:
	bool Init();
	void UnInit();
	//////////////////////////////  IServerMessageHandler ////////////////////////////////////////////
	virtual void		onClientMessage(uint32_t actionId, RECV_PACKAGE &package, uint64_t Id = 0);
	virtual const char* getClientHandlerDebugInfo(void) { return "LogicCampModule::onClientMessage"; };
	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void){ return "LogicCampModule::onServerMessage"; }
	virtual void		OnExecute(uint16_t nEventID, uint64_t nSrcID, uint8_t bySrcType, void *pContext, int32_t nLen);
private:
	//客户端请求朝拜属性数据
	void ClientToLogic_CampPrayAttInfo(CharIDType charId, RECV_PACKAGE &package);
	//客户端请求朝拜
	void ClientToLogic_CampPrayReq(CharIDType charId, RECV_PACKAGE &package);
	//中心服通知逻辑服阵营朝拜属性改变
	void CenterToLogic_CampAttChange(RECV_PACKAGE &package);
	//中心服通知逻辑服玩家阵营信息
	void CenterToLogic_NotifyCampCharInfo(RECV_PACKAGE &package);
	//中心服请求逻辑服验证阵营公告扣费
	void CenterToLogic_CampCheckNoticeCost(RECV_PACKAGE &package);
	//中心服请求逻辑服验证竞选申请扣费
	void CenterToLogic_CampCheckElectionCost(RECV_PACKAGE &package);
	//中心服请求逻辑服验证投票
	void CenterToLogic_CampCheckVote(RECV_PACKAGE &package);
	//中心服通知逻辑服朝拜扣除消耗
	void CenterToLogic_CampCheckPrayCost(RECV_PACKAGE &package);
	//中心服通知逻辑服加钱币或物品
	void CenterToLogic_CampAddSth(RECV_PACKAGE &package);
	//中心服通知逻辑服更换阵营标记
	void CenterToLogic_ChangeCamp(RECV_PACKAGE &package);
	//中心服通知逻辑服创建/更新阵营首领
	void CenterToLogic_ChangeCampLeader(RECV_PACKAGE &package);
	//中心服请求逻辑服验证更换阵营
	void CenterToLogic_CampChangeReq(RECV_PACKAGE &package);
	//角色死亡
	void OnPlayerDead(DieEvent *pEvent);
	//角色升级
	void OnPlayerLvUp(PlayerLeveUpEvent *pEvent);
	//角色加点
	void OnPlayerAddPoint(AddPoingEvent *pEvent);
public:
	static uint32_t camp_open_level;
	static uint32_t CampLightLeaderNpc;
	static uint32_t CampDarkLeaderNpc;
	LogicCampModule();
	virtual ~LogicCampModule();
};